<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
	<script type="text/javascript" src="../layer/layer.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>

</head>
<body>
<form class="form-inline definewidth m20" action="#" id="myForm">
   <table>
		<tr>
			<td align="right">原密码:</td>
			<td><input type="password" name="u_passWord"/></td>
		</tr>
		<tr>
			<td align="right">新密码:</td>
			<td><input type="password" name="newPsw"/></td>
		</tr>
		<tr>
			<td align="right">确认密码:</td>
			<td><input type="password" name="confirmPsw"/></td>
		</tr>
		<tr>
			<td colspan="2" align="center"><br/>
				<input type="button" value="保存" onclick="upload()" class="btn btn-primary"/>
			</td>
		</tr>
   </table>
</form>
</body>
</html>
<script>
	function upload(){
		let windowId = layer.load();
		$.ajax({
			type: "POST",
			url: "/login/update",
			data: $("#myForm").serialize()+"&_method=PUT",
			dataType: "json",
			success: function (vo) {
				layer.close(windowId);
				alert(vo.msg);
				if (vo.code == 200){
					logout();
				}
			}
		});
	}

	function logout(){
		$.ajax({
			type: "GET",
			url: "/login/logout",
			data: "",
			dateType: "json",
			success: function(vo){
				if(vo.code==200) {
					window.top.location.href = "/pages/login.html";
				}
			}
		});
	}
</script>